package com.bytezreo.statictest;

/**
 * 
 * @Description static 关键字的使用 小练习
 * @author Bytezero·zhenglei!        Email:420498246@qq.com
 * @version
 * @date 下午12:51:45
 * @
 *
 */
public class CircleTest 
{
	public static void main(String[] args) 
	{
		Circle c1 = new Circle();
		
		Circle c2 = new Circle();
		
		Circle c3 = new Circle();
		System.out.println("c1的id:"+c1.getId());
		System.out.println("c2的id:"+c2.getId());
		System.out.println("c3的id:"+c3.getId());
		
		System.out.println("创建圆的个数为："+Circle.getTotal());
		
		
	}
}

class Circle
{
	private double radius;
	private int id;     //自动赋值
	
	//构造器
	public Circle()
	{
		id = init++;
		total++;
	}
	
	public Circle(double radius)
	{
		this();
//		id = init++;        //自动累加id
//		total++;
		
		this.radius = radius;
		
	}
	
	

	private static int total;   //记录创建圆的个数
	private static int init = 1001;     //静态 多个对象共享
	
	public double findArea()
	{
		return 3.14 * radius * radius;
	}

	public double getRadius() {
		return radius;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}

	public int getId() {
		return id;
	}

	public static int getTotal() {
		return total;
	}



	
	
	
	
}